import { request } from "./request";

// 获取教材列表
export function getListeningBooks(data) {
  return request(
    { url: "/api/listening", method: "post" },
    {
      data,
    }
  );
}

// 获取教材详情
export const getBookDetails = async (data) => {
  return await request(
    { url: "/api/listening/detail", method: "post" },
    {
      data,
    }
  );
};

// 获取章节列表
export const getBookChapterlist = async (data) => {
  return await request(
    { url: "/api/listening/chapterlist", method: "post" },
    {
      data,
    }
  );
};

// 获取章节详情
export const getBookChapterDetail = async (data) => {
  return await request(
    { url: "/api/listening/chapterdetail", method: "post" },
    {
      data,
    }
  );
};

// 获取模拟试题
export const getMockTests = async (data) => {
  return await request(
    { url: "/api/listening/questions", method: "post" },
    {
      data,
    }
  );
};

// 获取年级
export function getGrade() {
  return request({ url: "/api/grade_t", method: "post" });
}

//保存模拟试题
export function saveExercise(data) {
	return request({
		url: '/api/new_answer/saveExercise',
		method: "post"
	}, {
		data,
	});
};